import Vue from 'vue'
import Router from 'vue-router'

import Home from './views/home/home'
import Index from './views/Index/Index'
import Cinema from './views/cinema/cinema'
import Cheaper from './views/cheaper/cheaper'
import User from './views/user/user'
import List from './views/List/list'
import Detail from './views/detail/detail'
import City from './views/city/city'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      redirect:{name: 'home'}
      
    },
    {
      path:'/detail/:id',
      component:Detail
    },
    {
      path:'/city',
      component:City
    },
    {
      path: '/home',
      name:'home',
      component:Home,
      redirect:{"name":"index"},
      children:[
        {
          path:"/home/index",
          name:'index',
          component:Index,
          redirect:{'path':'/home/index/1'},
          children:[{
            path:':type',  // home/index/:type的简写
            name:'list',
            component:List
          }]
        },
        {
           path:"/home/cinema",
          name:'cinema',
          component:Cinema
        },
         {
           path:"/home/cheaper",
          name:'cheaper',
          component:Cheaper
        },
        {
          path:"/home/user",
          name:'user',
          component:User
        }

      ]
      
    }
  ]
})
